using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace FanDongping.Stock
{
    public partial class FmViewStockInfos : Form
    {
        //StockData stockData;
        public FmViewStockInfos()
        {
            InitializeComponent();
            //stockData = sd;
        }

        private void SockView_Load(object sender, EventArgs e)
        {
            stockBindingSource.DataSource = StockData.StockList.Stocks;
            // stockBindingSource.DataMember= "Stocks";
        }

        private void btnNew_Click(object sender, EventArgs e)
        {
            FmEditStockInfo esi = new FmEditStockInfo();
            //esi.MdiParent = this;
            esi.Show();
        }
        private void btnReflesh_Click(object sender, EventArgs e)
        {
            stockBindingSource.CurrencyManager.Refresh();
        }

        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            EditCurrent();
        }

        private void EditCurrent()
        {
            Stock s = stockBindingSource.Current as Stock;
            FmEditStockInfo esi = new FmEditStockInfo(s);
            esi.Show();
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            EditCurrent();
        }
    }
}